// pages/my_pay/my_pay.js

import config from './../../config';
import {
    message,
    session,
    getOpenId
} from './../../utils/helper';
import {
    getMyPay
} from './../../services/my_pay';
import qs from 'qs';

//获取应用实例
const app = getApp();
//实例化本地缓存
const cookie = new session();

Page({

    /**
     * 页面的初始数据
     */
    data: {
        lists: []
    },

    /**
     * 生命周期函数--监听页面加载
     */
    onLoad: function(options) {
        //显示当前页面的转发按钮
        wx.showShareMenu({
            withShareTicket: true
        });
        let that = this;
        getOpenId(openid => {
            getMyPay({
                openid: openid
            }, {
                success: (res) => {
                    that.setData({
                        lists: res.data
                    });
                }
            });
        });
    },

    /**
     * 页面相关事件处理函数--监听用户下拉动作
     */
    onPullDownRefresh: function() {
        this.onLoad();
        wx.stopPullDownRefresh();
    }
})